<template>
	<view class="page tn-safe-area-inset-bottom" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
		<view class="top-bg"></view>
		<dawnBar title="来院导航"></dawnBar>
		<view class="page-container" style="padding-bottom: 140rpx;">
			<!-- 医院信息 -->
			<view class="hosp-info">
				<view class="list-item" style="padding: 10px;">
					<view class="list-content tn-flex tn-flex-nowrap tn-flex-col-center tn-flex-row-between">
						<view class="tn-flex tn-flex-direction-column">
							<view class="tn-flex tn-flex-nowrap  tn-flex-col-center tn-flex-row-left">
								<view @click="navNoAuth('/hosp/company/detail')" v-if="appConfig.logoUrl">
									<!-- <image mode="aspectFill" class="hosp-image" :src="appConfig.logoUrl"/> -->
									<tn-avatar :src="appConfig.logoUrl" size="120rpx"></tn-avatar>
								</view>
								<view class="tn-padding-left-xs">
									<view @click="navNoAuth('/hosp/company/detail')">
										<text
											class="dawn-text-md tn-text-bold tn-color-dawn">{{ appConfig.appTitle || ''}}</text>
									</view>
									<view class="tn-margin-top-ss">
										<tn-tag
											class="dawn-tag-sm dawn-tag-sm__1">{{appConfig.companyRespVO.nature || '' }}</tn-tag>
										<text class="tn-color-gray tn-padding-left-xs tn-padding-right-xs">|</text>
										<tn-tag
											class="dawn-tag-sm dawn-tag-sm__2">{{appConfig.companyRespVO.business || '' }}</tn-tag>
										<text class="tn-color-gray tn-padding-left-xs tn-padding-right-xs">|</text>
										<tn-tag
											class="dawn-tag-sm dawn-tag-sm__3">{{appConfig.companyRespVO.level || '' }}</tn-tag>
									</view>
									<view class="tn-margin-top-ss">
										<view @click="callPhoneNumber(appConfig.companyRespVO.phone)">
											<text
												class="tn-icon-tel-circle-fill tn-margin-right-ss tn-color-dawn"></text>
											<text class="dawn-text-sm">{{ appConfig.companyRespVO.phone  || '' }}</text>
										</view>
									</view>
								</view>
							</view>

							<view class="tn-margin-top-ss" @click="navNoAuth('/hosp/company/map')">
								<view>
									<text class="tn-icon-map-fill tn-margin-right-ss tn-color-dawn"></text>
									<text>{{appConfig.companyRespVO.address || '' }}</text>
								</view>
							</view>
						</view>
						<view @click="navNoAuth('/hosp/company/detail')"
							class="tn-flex tn-flex-nowrap tn-flex-col-center tn-flex-row-right">
							<view class="tn-text-right">
								<text class="tn-icon-right tn-color-gray"></text>
							</view>
						</view>
					</view>
				</view>
			</view>

			<view class="tn-flex tn-padding-top-sm tn-flex-row-between">
				<view class="justify-content-item tn-text-bold tn-text-xl">
					<text class="tn-icon-title "></text>
					<text class="">导航信息</text>
				</view>

			</view>

			<view class="">
				<block v-for="(item, index) in list" :key="index">
					<view @click="newsDteail(item)"
						class="tn-bg-white dawn-shadow dawn-radius tn-margin-top-sm dawn-radius tn-padding-sm">
						<view class="tn-flex tn-flex-col-center">
							<view>
								<image mode="widthFix" class="map-image" :src="item.coverImg" />
							</view>
							<view class="tn-flex tn-flex-col-center tn-flex-row-between" style="width: 100%;">
								<view class="tn-padding-left-xs">
									<view class="tn-text-lg tn-text-bold news-title">
										{{ item.title }}
									</view>
									<view class="">
										<text class=" tn-text-sm tn-color-gray">
											{{ item.description }}
										</text>
									</view>
									<view class="tn-flex tn-flex-row-right tn-flex-col-between tn-padding-top-xs">
										<view class="justify-content-item tn-color-gray tn-text-center tn-color-gray"
											style="padding-top: 5rpx;">
											<text class="tn-icon-footprint tn-padding-right-xs"></text>
											<text class="tn-padding-right">{{ item.views }}</text>
											<text class="tn-icon-time-fill tn-padding-right-xs"></text>
											<text class="">{{ formatDate(item.createTime) }}</text>
										</view>
									</view>
								</view>
								<view class="tn-flex tn-flex-nowrap tn-flex-col-center tn-flex-row-right">
									<view class="tn-text-right">
										<text class="tn-icon-right tn-color-gray"></text>
									</view>
								</view>
							</view>

						</view>
					</view>
				</block>
			</view>

			<view v-if="show">
				<dawnMsg :box="dawnMsgBox" :msg="msg"></dawnMsg>
			</view>
		</view>

		<!-- loading -->
		<dawnLoading :show="loading"></dawnLoading>

		<!-- 悬浮按钮-->
		<NavBtn></NavBtn>
	</view>
</template>

<script>
	import page_mixin from '@/mixins/page_mixin.js'
	import dayjs from '@/plugin/dayjs/dayjs.min.js';
	import * as ArticleApi from '@/api/cms/article.js';
	import * as api from '@/api/api.js';
	import * as config from "@/api/config.js";
	import {
		toLogin
	} from '@/libs/login.js';
	import {
		mapGetters
	} from "vuex";
	const app = getApp();

	export default {
		name: 'order',
		mixins: [page_mixin],
		computed: mapGetters(['appConfig', 'uid', 'isLogin', 'userInfo', 'patientInfo']),
		data() {
			return {
				loading: false,
				show: false,
				msg: '',
				dawnMsgBox: '',
				list: []
			}
		},
		onLoad(options) {
			this.getData();
		},
		onShow() {
			// this.getData();
		},
		methods: {
			getData() {
				let that = this;
				ArticleApi.getArticlePage({
					categoryKey: config.CMS_TYPE.MAP
				}).then(res => {
					console.table(res)
					if (res.code === 0) {
						const l = res.data.list || [];
						if (l.length > 0) {
							that.$set(this, 'list', l);
						}
					}
				});
			},
			formatDate: function(date) {
				return dayjs(date).format("YYYY-MM-DD");
			},
			formatDateTime: function(date) {
				return dayjs(date).format("YYYY-MM-DD HH:mm:ss");
			}
		}
	}
</script>

<style lang="scss" scoped>
	.tn-avatar {
		z-index: 0 !important;
	}
</style>